package com.shujia.wyh.day10;

import java.util.LinkedList;

//要求是底层是LinkedList
public class MyCollection {
    private LinkedList linkedList;

    public MyCollection() {
        linkedList = new LinkedList();
    }

    //创建添加元素的方法
    public void myAdd(Object o){
//        linkedList.addFirst(o);
        linkedList.add(o); //压栈
    }

    public Object myGet(){
//        return linkedList.get(index);
        return linkedList.removeLast(); //弹栈
    }

    public int getLength(){
        return linkedList.size();
    }
}
